import request from '@/utils/request'


const reqLogin ={
 

    //登录
    login:(username,password)=>{
      return request.post('/user/login',{
        "username":username,
        "password":password
      }).then(res=>{
        return res.data
      })
      
    },
    //注销
    loginout:()=>{
        return request.get('/user/loginout').then(res=>{
            return res.data
        })
    },

    //注册
    register:(username,password,email)=>{
       return request.post("/user/register",
       {
         "username":username,
         "password":password,
         "email":email
       }).then(res=>{
         return res.data
       })
          
       },
       //注册第二部
       register2:(username,code)=>{
        return request.get("/user/register/step2?username="+username+"&code="+code).then(res=>{
          return res.data;
        })
       },
       //发送验证码
       sendCode:(username,toemail)=>{
        return request.get("/user/regiser/sendcode?username="+username+"&email"+toemail).then(res=>{
          return res.data
        })
       }

}

export default reqLogin;